package com.sfac.javaSpringCloudAccount.controller;

import java.util.List;

import com.sfac.entity.account.Menu;
import com.sfac.javaSpringCloudAccount.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/api/account/")
public class MenuController {
	
	@Autowired
	private MenuService menuService;
	
	/**
	 * 127.0.0.1/api/menus ---- get
	 */
	@GetMapping("/menus")
	public List<Menu> getAllMenus() {
		return menuService.getAllMenus();
	}
	
	/**
	 * 127.0.0.1/api/menus/1 ---- get
	 */
	@GetMapping("/menus/{userId}")
	public List<Menu> getMenusByUserId(@PathVariable int userId) {
		return menuService.getMenusByUserId(userId);
	}

}
